/*
* ============================================================================
*  Name     : CSACommonTimer from SACommonTimer.h
*  Part of  : SA
*  Created  : 2010-06-04
*  Version  : 1.00
*  Copyright: 
* ============================================================================
*/

#ifndef __SA_COMMON_TIMER_H__
#define __SA_COMMON_TIMER_H__

// System includes
#include <e32base.h>

// Forward declarations
class CSACommonTimer;


class MSACommonTimerObserver
{
public:
	virtual void TimerCompleteL(CSACommonTimer* aTimer, TInt aError) = 0;
};

class CSACommonTimer	: public CActive
{
public:			// Constructor, destructor
	static CSACommonTimer* NewL(MSACommonTimerObserver& aObserver);
	static CSACommonTimer* NewL(MSACommonTimerObserver& aObserver, TInt aTime);
	~CSACommonTimer();

public:			// Functions from CActive
	void RunL();
	void DoCancel();

public:			// New functions
	TBool SetTime(TInt aTime);
	void ResetTime();
	TBool RestartTimer();
	TBool AtTime(TTime aTime);
	TBool ReAtTime();

private:		// Constructor
	CSACommonTimer(MSACommonTimerObserver& aObserver, TInt aTime);
	void ConstructL();

private:		// Data
	MSACommonTimerObserver&			iObserver;
	TInt								iTime;
	TTime								iAtTime;
	RTimer								iTimer;
};

#endif	//__SA_COMMON_TIMER_H__

// End of File
